﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Serveur.DataAccess;
using DBO.Utility;
using System.Net.Mail;
using Misc;

namespace BusinessManagement
{
    public static class AccountManager
    {
        public static bool CreateAccount(PLICCredentials Creds, MailAddress Address, string Race)
        {
            Logger.ConsoleLogger.Log("Account manager, create account for " + Address.Address);
            return DA.CreateUser(Creds, Address, Race);
        }

        public static void ChangePassword(string Login, MailAddress Address)
        {
            string pass = DA.ChangePassword(Login, Address);
            Mailer Mailer = new Mailer();

            Mailer.send(Address.ToString(), "[PLIC] New password", "Hello " + Login +
                ", <br/><br/>" + "Here is your new password : " + "<b>" + pass + "</b>" +
                "<br/><br/>Sheers !");
        }

        private static SessionDataAccess DA = new SessionDataAccess();
    }
}
